package object2;

/**
 * 继承的细节
 */
public class PolyDetail02 {

    public static void main(String[] args) {

        /*
            属性没有重写之说！属性的值看编译类型
         */

        PolyDetail02Base polyDetail02Base = new PolyDetail02Sub();//向上转型
        System.out.println(polyDetail02Base.count);//编译类型 polyDetail02Base，所以取它的属性 10

        PolyDetail02Sub polyDetail02Sub = new PolyDetail02Sub();
        System.out.println(polyDetail02Sub.count);//编译类型 polyDetail02Sub，所以取它的属性 20

    }
}

class PolyDetail02Base {//父类

    int count = 10;

}

class PolyDetail02Sub extends PolyDetail02Base {//子类

    int count = 20;

}